<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function up(x) {
            var a = x.parentNode.parentNode;
            var tr = document.getElementById("tb").getElementsByTagName("tr");
            var temp = "";
            for (var i = 0; i < tr.length; i++) {
                if (a.innerHTML.charAt(13) == tr[i].innerHTML.charAt(13) && tr[i - 1].style.color != "red") {
                    temp = a.innerHTML;
                    a.innerHTML = tr[i - 1].innerHTML;
                    tr[i - 1].innerHTML = temp;
                }
            }
        }

        function down(x) {
            var a = x.parentNode.parentNode;
            var tr = document.getElementById("tb").getElementsByTagName("tr");
            var temp = "";
            for (var i = 0; i < tr.length; i++) {
                if (a.innerHTML.charAt(13) == tr[i].innerHTML.charAt(13) && a.style.color != "red") {
                    temp = a.innerHTML;
                    a.innerHTML = tr[i + 1].innerHTML;
                    tr[i + 1].innerHTML = temp;
                }
            }
        }

        function zd(x) {
            var a = x.parentNode.parentNode;
            var tr = document.getElementById("tb").getElementsByTagName("tr");
            tr[0].style.color = "red";
            var temp = "";
            for (var i = 0; i < tr.length; i++) {
                if (a.innerHTML.charAt(13) == tr[i].innerHTML.charAt(13)) {
                    temp = a.innerHTML;
                    a.innerHTML = tr[0].innerHTML;
                    tr[0].innerHTML = temp;
                }
            }
        }
    </script>
</head>
<body>
<table id="tb" border="0" cellpadding="0" cellspacing="0" width="50%">
    <tr>
        <td>纯CSS3制作漂亮的价格表</td>
        <td>2015-04-10</td>
        <td><input type="button" value="上移" onclick="up(this)"/> <input type="button" value="下移" onclick="down(this)"/>
            <input type="button" value="置顶" onclick="zd(this)"/>
        </td>
    </tr>
    <tr>
        <td>HTML5获取地理位置定位信息</td>
        <td>2015-04-25</td>
        <td><input type="button" value="上移" onclick="up(this)"/> <input type="button" value="下移" onclick="down(this)"/>
            <input type="button" value="置顶" onclick="zd(this)"/>
        </td>
    </tr>
    <tr>
        <td>CSS+Cookie实现的固定页脚广告条</td>
        <td>2015-04-18</td>
        <td><input type="button" value="上移" onclick="up(this)"/> <input type="button" value="下移" onclick="down(this)"/>
            <input type="button" value="置顶" onclick="zd(this)"/>
        </td>
    </tr>
    <tr>
        <td>jQuery实现的测试答题功能</td>
        <td>2015-03-29</td>
        <td><input type="button" value="上移" onclick="up(this)"/> <input type="button" value="下移" onclick="down(this)"/>
            <input type="button" value="置顶" onclick="zd(this)"/>
        </td>
    </tr>
</table>
</body>
</html>